home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_oilsheddoor.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  268 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_OilShedDoor.cog
  4. #
  5. # oilkey = 108
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols        
  13.     
  14.     message     startup
  15.     message     activate
  16.  
  17.     thing       player      local
  18.     thing       oilCan      local
  19.     thing        door
  20.     thing       cam1
  21.     thing       cam2        # temp camera for interp
  22.     thing       camTarg
  23.     thing       ghostPos
  24.     thing       oilGhost
  25.     thing       offsetCam
  26.     
  27.     template    tplOil=oilcanmove               local
  28.     
  29.     # need a key lines
  30.     sound       in_WontLine0=Inxj082.wav        local   # there's a key hole...
  31.     sound       in_WontLine1=Inxj076.wav        local   # This door is locked
  32.     sound       in_WontLine2=Inxj077.wav        local   # it's locked
  33.     
  34.     # using the wong or no item lines
  35.     sound       in_WrongLine0=Inxj089.wav       local   # that didn't work
  36.     sound       in_WrongLine1=Inxj058.wav       local   # that won't work.
  37.     sound       in_WrongLine2=Inxj088.wav       local   # nope
  38.     
  39.     sound       snd_OilCan=inxj249.wav          local   # an oil can.
  40.     
  41.     cog         talkCog         local
  42.     cog         hintCog
  43.     
  44.     int         open=0          local
  45.     int         curCam          local
  46.     int         playing=0       local
  47.     int         whichLine=0     local
  48.     int         gotIt=0         local
  49.     int         newComment      local
  50.     int         oldComment      local
  51.     int         curItem         local
  52.     
  53.     # ** subroutines **
  54.     flex        speak           local
  55.     flex        getOil          local
  56.     flex        openDoor        local
  57.  
  58. end
  59.  
  60. # ========================================================================================
  61.  
  62. code
  63.  
  64. startup:
  65.  
  66.     SetThingLight(door, '0.3 0.3 0.35', 0.001, 2.0);
  67.     return;
  68.  
  69. # ========================================================================================
  70.  
  71. activate:
  72.  
  73.     player = GetLocalPlayerThing();
  74.     curCam = GetCurrentCamera();
  75.     curItem = GetCurItem(player);
  76.     
  77.     if((GetSenderRef() == door) && (open == 0) && (playing == 0))
  78.     {    
  79.         if(curItem == 108)
  80.         {
  81.             open = 1;
  82.             Call openDoor;
  83.         }
  84.         
  85.         # player doesn't have or is not using the key
  86.         else if(curItem == 0)
  87.         {
  88.             playing = 1;
  89.             whichLine = 0;
  90.             Call speak;
  91.         }
  92.             
  93.         else
  94.         {
  95.             playing = 1;
  96.             whichLine = 1;
  97.             Call speak;
  98.         }
  99.     }
  100.     
  101.     else if((GetSenderRef() == oilCan) && (gotIt == 0))
  102.     {
  103.         gotIt = 1;
  104.         #whichLine = 1;
  105.         Call getOil;
  106.     }
  107.  
  108.     return;
  109.  
  110. # ========================================================================================
  111.  
  112. openDoor:
  113.  
  114.     # do cutscene stuff
  115.     MakeMeStop();
  116.     StartCutscene(0);
  117.     
  118.     # offset camera and nudge door
  119.     SetExtCamOffsetToThing(offsetCam);
  120.     
  121.     # put away any weapon
  122.     DeselectWeaponWait(player);
  123.     
  124.     PlayMode(player, 60, 0);
  125.     Sleep(0.3);
  126.     
  127.     ChangeInv(player, 108, -1);
  128.             
  129.     # create oilCan item
  130.     oilCan = CreateThing(tplOil, oilGhost);
  131.     CaptureThing(oilCan);
  132.     
  133.     # disable player, nudge the door
  134.     SetActorFlags(player, 0x200000);
  135.     PlayMode(player, 60, 0);
  136.     Sleep(0.5);
  137.     
  138.     # switch to camera inside shed
  139.     SetCameraFocus(2, cam1);
  140.     SetCameraSecondaryFocus(2, camTarg);
  141.     SetCurrentCamera(2);
  142.     
  143.     # move player away from door
  144.     CopyOrientAndPos(ghostPos, player);
  145.     
  146.     Sleep(0.5);
  147.     
  148.     # open door
  149.     Rotate(door, 90, 1, 2.0);
  150.     WaitForStop(door);
  151.     
  152.     Sleep(0.5);
  153.     
  154.     # restore curCam
  155.     SetCameraPosition(curcam, GetThingPos(cam2));
  156.     SetCurrentCamera(curCam);
  157.     
  158.     # restore offsetCam and controls
  159.     RestoreExtCam();
  160.     ClearActorFlags(player, 0x200000);
  161.     EndCutscene();
  162.  
  163.     return;
  164.     
  165. # ========================================================================================
  166.  
  167. getOil:
  168.  
  169.     # do cutscene stuff
  170.     MakeMeStop();
  171.     StartCutscene(0);
  172.     
  173.     # offset camera
  174.     #SetExtCamOffsetToThing(offsetCam);
  175.     SetCameraFocus(2, offsetCam);
  176.     SetCameraSecondaryFocus(2, player);
  177.     SetCurrentCamera(2);
  178.     
  179.     # put away any weapon
  180.     DeselectWeaponWait(player);
  181.     #Sleep(1.0);
  182.     
  183.     # pickup the oilCan
  184.     PlayMode(player, 60, 0);
  185.     Sleep(0.3);
  186.     DestroyThing(oilCan);
  187.     
  188.     # Call the Pickup Lines cog
  189.     talkCog = GetCogByIndex(0);
  190.     SendMessage(talkCog, 27);
  191.     
  192.     # sleep to wait for talkCog
  193.     Sleep(1.3);
  194.     
  195.     # add oilCan to inventory
  196.     SetInvAvailable(player, 81, 1);
  197.     ChangeInv(player, 81, 1.0);
  198.     JonesInvItemChanged(81);
  199.         
  200.     # Johnny, tell the player what he's picked up
  201.     PlayVoice(player, snd_OilCan, 1.0, 1);
  202.     
  203.     Sleep(1.0);
  204.     
  205.     # restore camera
  206.     #RestoreExtCam();
  207.     SetCurrentCamera(1);
  208.     
  209.     # restore player contrls
  210.     ClearActorFlags(player, 0x200000);
  211.     
  212.     EndCutscene();
  213.     
  214.     # solve hint13
  215.     SendMessage(hintCog, user0);
  216.     
  217.     return;
  218.     
  219. # ========================================================================================
  220.  
  221. speak:
  222.  
  223.     while (newComment == oldComment) 
  224.     {
  225.         newComment = RandBetween(0, 2);
  226.     }
  227.     
  228.     oldComment = newComment;
  229.     
  230.     playing = 1;
  231.     
  232.     # do cutscene stuff
  233.     MakeMeStop();
  234.     StartCutscene(0);
  235.     
  236.     # offset camera and nudge door
  237.     SetExtCamOffsetToThing(offsetCam);
  238.     
  239.     # put away any weapon
  240.     DeselectWeaponWait(player);
  241.     
  242.     PlayMode(player, 60, 0);
  243.     Sleep(0.3);
  244.     
  245.     if(whichLine == 0)
  246.     {
  247.         PlayVoice(player, in_WontLine0[newComment], 1.0, 1);
  248.     }
  249.     
  250.     else if(whichLine == 1)
  251.     {
  252.         PlayVoice(player, in_WrongLine0[newComment], 1.0, 1);
  253.     }
  254.     
  255.     # restore offsetCam and controls
  256.     RestoreExtCam();
  257.     ClearActorFlags(player, 0x200000);
  258.     EndCutscene();
  259.     
  260.     playing = 0;
  261.     
  262.     return;
  263.     
  264. # ========================================================================================
  265.     
  266. end
  267.  
  268.